<%@ page language="java" import="java.util.*" contentType="text/html"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		 <link rel="stylesheet" href='<c:url value="/share/bootstrap.min.css"></c:url>'> 
		 <script src='<c:url value="/js/jquery.min.js"></c:url>'></script>
		<script src='<c:url value="/js/bootstrap.min.js"></c:url>'></script>
		<script src='<c:url value="/js/all.js"></c:url>'></script> 
		<script type="text/javascript" src='<c:url value="/js/boot.js"></c:url>'></script>
		<script type="text/javascript"
		src='<c:url value="/js/rqfui/rqfui.js"></c:url>'></script>
		<style type="text/css">
			.Examination_list{
				margin: 20px 0px;
			}	
			 .Examination_list>li{
				text-align: left;
				padding: 15px;
				margin: 20px 0;
				border: 1px solid #494949;
				list-style-type:none;
			}
			.Examination_list>li:nth-child(1){
				margin-top: 0;
			}
			.Examination_list>li:nth-last-child(1){
				margin-bottom: 0;
			}
			.Examination_list_title{
				border: 1px solid #a4a4a4;
				padding: 6px 12px;
				color: #295c96;
			}
			.Examination_list_title>span{
			    color: #9A9A9A;
			    padding-left:20px;
			}
			.Examination_list_content{
				border: 1px solid #a4a4a4;
				padding: 10px 25px;
				margin-top: 10px;
			}
			.Examination_list_content>li{
				width: 100% !important;
				position: relative;
	    		overflow: hidden;
	    		padding: 4px 0;
			}
			.Examination_list_content>li>input{
				float: left;
				margin-right: 10px;
			}	
			.home_content_01 {
			    margin-top: 5% !important;
			    margin-bottom: 5% !important;
			    padding: 10px;
			    background: #fff;
			    box-shadow: 0 1px 2px grey; 
			}
			.center_01 {
			    max-width: 1190px;
			    padding: 0px;
			    margin: 0 auto;
			}
			.firstline{
				display: inline;
				float: left;
			}
			
		</style>	
	</head>
	<body >
			
		<div class="home_content_01 center_01">
				<div style="margin:0 77px;">		
					<div class="firstline" style="width: 8%;margin-bottom: 20px;">
						<img src='<c:url value="/share/images/diaoyan_03.png"></c:url>' />
					</div>
					<div class="firstline" style="width: 80%;margin-top: 25px; ">
						<div style="text-align: center; font-size:18px; font-family: '微软雅黑';color: #2d60b0;" id="name">
						</div>
						<div style="text-align: left;padding: 20px ;line-height:22pt;color: #888888;" id="direction">
						</div>
					</div>
					<div class="firstline" style="width: 12%;color: #1e519f;margin-top: 25px;" >
						<a href="#" style="text-decoration: none;"></a>
					</div>
				</div>	
				<div  style="margin:10px 90px ;clear: both;">
					<ul class="Examination_list" style="width: 100%;max-width: 1190px;" id="questionType_0">
					</ul>
					<ul class="Examination_list" style="width: 100%;max-width: 1190px;" id="questionType_1">
					</ul>
					<ul class="Examination_list" style="width: 100%;max-width: 1190px;" id="questionType_2">
					</ul>
					<ul class="Examination_list" style="width: 100%;max-width: 1190px;" id="questionType_3">
					</ul>
					<div height="50px"></div>	
				</div>
		</div>
	</body>
	<script type="text/javascript">
	var rootPath = '${rootPath}';
	var paperId = '${paperId}';
	var questionId="";
	$(function(){
		getTestIdList();
		getMap();
	})
	function getMap(){
		var url = rootPath + "/surveyPaper/map/" + paperId;
		$.ajax({
			url : url,
			method : "post",
			dataType : "json",
			data : {},
			success : function(data) {
				if (data) {
					$("#direction").html(data.direction);
					$("#name").html(data.name);
				} else {
					//alert("获取信息失败！");
				}
			},
			error : function() {
				mini.alert("失败！");
			}
		});
	}
	function getTestIdList() {
		var url = rootPath + "/surveyPaper/testList/" + paperId;
		$.ajax({
			url : url,
			method : "post",
			dataType : "html",
			data : {},
			success : function(data) {
				if (data) {
					questionId = data;
					getTestList(questionId);
				} else {
					//alert("获取信息失败！");
				}
			},
			error : function() {
				mini.alert("失败！");
			}
		});
	}
	function getTestList(id) {
		var url = rootPath + "/surveyPaper/questionListData";
		$.ajax({
			url : url,
			method : "post",
			dataType : "json",
			data : {
				'data' : id
			},
			success : function(data) {
				if (data) {
					showTest(data);
				} else {
					//alert("获取信息失败！");
				}
			},
			error : function() {
				alert("失败！");
			}
		});
	}
	
	function showTest(data) {
		var htmStr0=""; 
		var htmStr1=""; 
		var htmStr2=""; 
		var htmStr3=""; 
		var htmStr="";
		for(var i = 0; i < data.length; i++){
			if (data[i].class_id == "单选题") {
				htmStr0 += "<li><div class=\"close\" style=\"margin-top:-15px;margin-right: -45px;\">"
					+ "</div>"
					+ "<div class=\"Examination_list_title\">"
					+ "<font>"
					+ data[i].question
					+ "</font><span>（单选）</span>"
					+ "</div>"
					+ "<ul class=\"Examination_list_content\">";
				var str = data[i].selects;
				var arr = str.split(",nwebadjj,_");
				for (var j = 0; j < arr.length; j++) {
					var option = String.fromCharCode(j + 65);
					htmStr0 += "<li>"
							+ "<input type=\"radio\" name=\"radio1\" />&nbsp;"
							+ "<font>" + option + '、' + arr[j] + "</font>"
							+ "</li>";
				}
				htmStr0 += "</ul></li>";
			}else if (data[i].class_id == "多选题") {
				htmStr1 += "<li><div class=\"close\" style=\"margin-top:-15px;margin-right: -45px;\">"
					+ "</div>"
					+ "<div class=\"Examination_list_title\">"
					+ "<font>"
					+ data[i].question
					+ "</font><span>（多选）</span>"
					+ "</div>"
					+ "<ul class=\"Examination_list_content\">";
				var str = data[i].selects;
				var arr = str.split(",nwebadjj,_");
				for (var j = 0; j < arr.length; j++) {
					var option = String.fromCharCode(j + 65);
					htmStr1 += "<li>"
							+ "<input type=\"checkbox\" name=\"check1\" />&nbsp;"
							+ "<font>" + option + '、' + arr[j] + "</font>"
							+ "</li>";
				}
				htmStr1 += "</ul></li>";
			}else if (data[i].class_id == "判断题") {
				htmStr2 += "<li><div class=\"close\" style=\"margin-top:-15px;margin-right: -45px;\">"
					+ "</div>"
					+ "<div class=\"Examination_list_title\">"
					+ "<font>"
					+ data[i].question
					+ "</font><span>（判断）</span>"
					+ "</div>"
					+ "<ul class=\"Examination_list_content\">";
				htmStr2 += "<li><input type=\"radio\" name=\"radio1\" />&nbsp;<font>是</font>"
							+ "</li><li><input type=\"radio\" name=\"radio1\" />&nbsp;<font>否</font>"
							+ "</li>";
				htmStr2 += "</ul></li>";
			}else if (data[i].class_id == "问答题") {
				htmStr3 += "<li><div class=\"close\" style=\"margin-top:-15px;margin-right: -45px;\">"
					+ "</div>"
					+ "<div class=\"Examination_list_title\">"
					+ "<font>"
					+ data[i].question
					+ "</font><span>（问答）</span>"
					+ "</div>"
					+ "<ul class=\"Examination_list_content\">";
				htmStr3 += "<p style =\"height:45px\"></p>";
				htmStr3 += "</ul></li>";
			}
		}
		$("#questionType_0").html(htmStr0);
		$("#questionType_1").html(htmStr1);
		$("#questionType_2").html(htmStr2);
		$("#questionType_3").html(htmStr3);
	}
	</script>
</html>
